# coding: utf-8
from pymongo import IndexModel, DESCENDING


def make_indexs(*args, name=None):
    indexs = []
    for filed in args:
        if isinstance(filed, str):
            filed = (filed, DESCENDING)
        indexs.append(filed)
    return IndexModel(indexs, name=name)


def select_fields(fields, status):
    field_json = {}
    [field_json.update({field: status}) for field in fields]
    return field_json
